import java.util.HashMap;
import java.util.Map;
import java.util.Random;

public class Map_test {
    public static void main(String[] args) {
        String[] xz={"A","B","C","D"};
        StringBuilder syxz=new StringBuilder();
        Random sj=new Random();
        for (int i = 0; i < 80; i++) {
            syxz.append(xz[sj.nextInt(xz.length)]);
        }
        Map<Character,Integer> a=new HashMap<>();
        for (int i = 0; i < syxz.length(); i++) {
            char s= syxz.charAt(i);
            if(a.containsKey(s)){
                //有键则值+1
                a.put(s,a.get(s)+1);
            }else{
                //没有值则放入键和值
                a.put(s,1);
            }
        }
        System.out.println(a);
    }
}
